package org.example.zpqy.repository;

import org.example.zpqy.bean.RecognitionHistory;
import org.example.zpqy.dto.HistoryResultDTO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RecognitionHistoryRepository extends JpaRepository<RecognitionHistory, Long> {
    // 修改查询，返回包含结果和时间的DTO列表
    @Query("SELECT new org.example.zpqy.dto.HistoryResultDTO(r.result, r.recognitionTime) FROM RecognitionHistory r ORDER BY r.id ASC")
    List<HistoryResultDTO> findAllResultsWithTime();
}